﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace FSY.Web.Admin.Menus
{
    public partial class Manager : System.Web.UI.UserControl
    {
        #region Variable
        #endregion

        #region Event
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                CheckAction();
            }
        }

        protected void btnDelete_Click(object sender, EventArgs e)
        {

        }
        #endregion

        #region Function
        private void CheckAction()
        {
            if (Request.QueryString["action"] != null)
            {
                string action = Request.QueryString["action"];
                switch (action)
                {
                    case "addItem":
                        btnDelete.Enabled = false;
                        SetVisiableControl(true, false, false);
                        break;
                    case "editItem":
                        SetVisiableControl(false, true, false);
                        break;
                    case "showAll":
                        SetVisiableControl(false, false, true);
                        break;
                    default:
                        SetVisiableControl(false, false, true);
                        break;
                }
            }
        }

        private void SetVisiableControl(bool newItem, bool editItem, bool showAllItem)
        {
            AddItem.Visible = newItem;
            EditITem.Visible = editItem;
            ShowAllItem.Visible = showAllItem;
        }
        #endregion
    }
}